package com.bwda.dsrs.base.centerbase.request;


/**
 * @author yangjun
 * @date 2019/3/18
 */
public abstract class BaseQueryRequest extends BaseRequest {
    private int pageNum;
    private int pageSize = 20;
    private String orderBy;

    @Override
    public void checkParam() {
        super.checkParam();
        if (this.pageNum < 0) {
            throw new IllegalArgumentException("pageNum 不能为负");
        } else if (this.pageSize < 1) {
            throw new IllegalArgumentException("pageSize 不能小于1");
        }
    }

    public BaseQueryRequest() {
    }

    public int getPageNum() {
        return this.pageNum;
    }

    public int getPageSize() {
        return this.pageSize;
    }

    public String getOrderBy() {
        return this.orderBy;
    }

    public void setPageNum(int pageNum) {
        this.pageNum = pageNum;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public void setOrderBy(String orderBy) {
        this.orderBy = orderBy;
    }



    @Override
    public String toString() {
        return "BaseQueryRequest(pageNum=" + this.getPageNum() + ", pageSize=" + this.getPageSize() + ", orderBy=" + this.getOrderBy() + ")";
    }
}